package com.sans.oop;

import org.junit.Test;

/**
 * @author Sans
 */
public class InitBlockTest {
    static class Dog {

        /**
         * 狗类构造器
         */
        public Dog() {
            this("25");
            System.out.println(3);
        }

        /**
         * 狗类构造器
         */
        public Dog(int age) {
            System.out.println(2);
        }

        /**
         * 狗类构造器
         */
        public Dog(String name) {
            this(25);
            System.out.println(1);
        }

        {
            System.out.println("我是动态块01");
        }

        {
            System.out.println("我是动态块02");
        }

        static {
            System.out.println("我是静态块01");
        }

        static {
            System.out.println("我是静态块02");
        }

    }

    @Test
    public void constructor() {
        new Dog();
        new Dog();
    }
}